﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using mesoBoard.Data;
using mesoBoard.Data.Repositories;
using System.Drawing.Imaging;
using System.Drawing;

namespace mesoBoard.Services
{
    public class ThreadImages : IThreadImages
    {
        private IRepositoriesWrapper Repositories;

        public ThreadImages(IRepositoriesWrapper repos)
        {
            this.Repositories = repos;
        }

        public string[] GetThreadImages()
        {
            string[] validExtensions = new string[] { ".gif", ".png", ".jpg", ".jpeg" };
            DirectoryInfo di = new DirectoryInfo(HttpContext.Current.Server.MapPath("~/Images/ThreadImages"));
            return di.GetFiles().Select(x => x.Name).Where(x=> validExtensions.Contains(Path.GetExtension(x))).OrderBy(x => x).ToArray();
        }
       
    }
}